# -*- coding:utf-8 -*-

from com.mat.rpa.utils.globalConstants import GlobalConstants
from com.mat.rpa.views.workWindow.leftPanel.directiveTree import treeItem
from . import excelAutoConstants
from .readingAndWritingOperations import readingAndWritingExcelSubDirectiveTree
from .sheetOperation import sheetOperationSubDirectiveTree
from .advancedExcelDirectives import advancedExcelDirectivesSubDirectiveTree
class ExcelAutoSubDirectiveTree(treeItem.TreeItemWithID):
    def __init__(self, parent):
        super(ExcelAutoSubDirectiveTree, self).__init__(parent)
        self.createExcelAutoTreeNode()

    def createExcelAutoTreeNode(self):
        self.nodeType = GlobalConstants.treeBranchType
        self.directiveType = "excelAutoNode"
        self.setText(0,"Excel自动化")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.startingExcelDirective, "启动Excel")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.gettingCurrentActiveExcelObjectDirective, "获取当前激活的Excel对象")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.saveOrSaveAsExcelDirective, "保存/另存Excel")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.closingExcelDirective, "关闭Excel")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.exportingAsPDFDirective, "导出为PDF")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.circulatingExcelDirective, "循环Excel内容")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.readingFromExcelDirective, "读取Excel内容")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, excelAutoConstants.ExcelAutoConstants.writingToExcelDirective, "写入内容到Excel表")
        #挂载读写Excel指令子节点
        readingAndWritingExcelSubDirectiveTree.ReadingAndWritingExcelSubDirectiveTree(self)
        #挂载Sheet操作子节点
        sheetOperationSubDirectiveTree.SheetOperationSubDirectiveTree(self)
        #挂载Excel高级指令子节点
        advancedExcelDirectivesSubDirectiveTree.AdvancedExcelDirectivesSubDirectiveTree(self)
